package xkp.lesson5;

public class Person {
	private static int count = 0;
	private int age;
	
	public void fun1() {
		int num = 234;
		this.count = 300;
		System.out.println("I am fun1....");
		fun2();
		count = 222;
	}
	
	//被static关键字修饰的资源可以直接通过类名称调用
	//被static关键字修饰的资源为静态资源，这些资源在程序运行时会被最先加载。
	public static void fun2() {
		System.out.println("I am fun1....");
		//age = 200;
		//fun1();
	}

	
	public static void main(String[] args) {
		/*
		 * Person person = new Person(); person.fun1(); Person.fun2();
		 */
		//非静态的成员变量必须要依赖对象。要先有对象，才有非静态的成员变量和方法
		//被static修饰的资源被所有对象共享
		//被static修饰的资源可以通过类名称访问，也可以对象名称访问
		Person person1 = new Person();
		person1.count = 250;
		Person person2 = new Person();
		System.out.println(person2.count);
		System.out.println(Person.count);
		
		person1.fun2();
		person2.fun2();
		Person.fun2();
	}
}
